home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Softshoe / Lisa's Mac Parts / Views / Pane Frames / JustifiedFrame.cp < prev    next >
Text File  |  2000-06-23  |  2KB  |  78 lines

  1. // JustifiedFrame.cp
  2.  
  3. #ifndef JustifiedFrame_h
  4. #include "JustifiedFrame.h"
  5. #endif
  6. #ifndef CellVisitor_h
  7. #include "CellVisitor.h"
  8. #endif
  9. #ifndef Justification_h
  10. #include "Justification.h"
  11. #endif
  12. #ifndef Overflow_h
  13. #include "Overflow.h"
  14. #endif
  15.  
  16. JustifiedFrame::JustifiedFrame( const Announcing<UPoint32>& size,
  17.                                           const Justification& h,
  18.                                           const Justification& v )
  19.   : PaneStack( size ),
  20.      interior( *this ),
  21.      exterior( *this ),
  22.      horizontal( h ),
  23.      vertical( v )
  24.   {
  25.   }
  26.  
  27. void JustifiedFrame::Arrange( UPoint32 size )
  28.   {
  29.     Rectangle32 outside( 0, 0, Asint32( size.h ), Asint32( size.v ) );
  30.     Rectangle32 inside( outside );
  31.     
  32.     horizontal.InsetWidth( inside, interior.Sizer().BestWidth( outside.Horizontal() ) );
  33.     vertical.InsetHeight( inside, interior.Sizer().BestHeight( outside.Vertical() ) );
  34.     
  35.     interior.SetBounds( inside );
  36.     exterior.SetBounds( outside );
  37.   }
  38.  
  39. int32 JustifiedFrame::MinimumWidth() const
  40.   {
  41.     return interior.Sizer().MinimumWidth();
  42.   }
  43.  
  44. int32 JustifiedFrame:: MinimumHeight() const
  45.   {
  46.     return interior.Sizer().MinimumHeight();
  47.   }
  48.  
  49. int32 JustifiedFrame:: MaximumWidth() const
  50.   {
  51.     return exterior.Sizer().MaximumWidth();
  52.   }
  53.  
  54. int32 JustifiedFrame:: MaximumHeight() const
  55.   {
  56.     return exterior.Sizer().MaximumHeight();
  57.   }
  58.  
  59. int32 JustifiedFrame:: ReasonableWidth() const
  60.   {
  61.     return interior.Sizer().ReasonableWidth();
  62.   }
  63.  
  64. int32 JustifiedFrame:: ReasonableHeight() const
  65.   {
  66.     return interior.Sizer().ReasonableHeight();
  67.   }
  68.  
  69. int32 JustifiedFrame::BestWidth( Range32 bounds ) const
  70.   {
  71.     return interior.Sizer().BestWidth( bounds );
  72.   }
  73.  
  74. int32 JustifiedFrame::BestHeight( Range32 bounds ) const
  75.   {
  76.     return interior.Sizer().BestHeight( bounds );
  77.   }
  78.